package com.weijx.dishes.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * com.weijx.dishes.controller.PageController
 * 描述：
 * on 2025/10/30-上午9:10
 *
 * @author weijx
 */
@Controller
public class PageController {

    /**
     * 首页 - 餐品展示
     */
    @GetMapping("/")
    public String index(Model model) {
        model.addAttribute("title", "🍽️ 点餐系统");
        model.addAttribute("subtitle", "亲爱的，你想吃什么？");
        return "front/index";
    }

    /**
     * 购物车页面
     */
    @GetMapping("/cart")
    public String cart(Model model) {
        model.addAttribute("title", "购物车");
        return "front/cart";
    }

    /**
     * 订单页面
     */
    @GetMapping("/order")
    public String order(Model model) {
        model.addAttribute("title", "提交订单");
        return "front/order";
    }

    /**
     * 订单处理页面
     */
    @GetMapping("/process")
    public String process(Model model, @RequestParam String orderId) {
        model.addAttribute("title", "处理订单");
        model.addAttribute("orderId", orderId);
        return "front/process";
    }
}